﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Gollie.Menu;

namespace Gollie.Controls
{
	public partial class Menu : BaseUserControl
	{
		string menuName = "visitor";
		MainMenu mainMenu;

		protected override void Render(HtmlTextWriter writer)
		{
			if (string.IsNullOrEmpty(this.menuName))
				return;

			this.mainMenu = CachedMenu.GetInstance().Menu[menuName];

			if (this.mainMenu == null)
				return;

			writer.Write(this.mainMenu.Html);
		}

		public string MenuName
		{
			get { return this.menuName; }
			set { this.menuName = value; }
		}
	}
}